package com.file_io;

import java.io.*;
import java.util.Scanner;

public class WorldCup {
    public static void main(String[] args)  {
        FileInputStream fis=null;
        InputStreamReader is=null;
        BufferedReader bd=null;
        Scanner in=new Scanner(System.in);
        System.out.println("请输入年份");
        String str=in.next();

        try {
            fis=new FileInputStream("E:\\project-java65-parents\\homeWork\\io\\io.txt");
            is=new InputStreamReader(fis);
            bd=new BufferedReader(is);

            boolean flag=true;
        String str1;
            while((str1=bd.readLine())!=null){

                if (str1.contains(str)){
                    System.out.println(str1);
                  flag=false;
                  return;
                }
            }
            if (flag){
                System.out.println("没有举办世界杯");
            }

        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                fis.close();
                is.close();
                bd.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
